package com.ruoyi.chart.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.chart.mapper.SchoolMapper;
import com.ruoyi.chart.domain.School;
import com.ruoyi.chart.service.ISchoolService;

import javax.annotation.Resource;

/**
 * 一卡通校园配置Service业务层处理
 *
 * @author ruoyi
 * @date 2023-04-10
 */
@Service
public class SchoolServiceImpl implements ISchoolService {
    @Resource
    private SchoolMapper schoolMapper;

    /**
     * 查询一卡通校园配置
     *
     * @param id 一卡通校园配置主键
     * @return 一卡通校园配置
     */
    @Override
    public School selectSchoolById(Long id) {
        return schoolMapper.selectSchoolById(id);
    }

    /**
     * 查询一卡通校园配置列表
     *
     * @param school 一卡通校园配置
     * @return 一卡通校园配置
     */
    @Override
    public List<School> selectSchoolList(School school) {
        return schoolMapper.selectSchoolList(school);
    }

    /**
     * 新增一卡通校园配置
     *
     * @param school 一卡通校园配置
     * @return 结果
     */
    @Override
    public int insertSchool(School school) {
        school.setCreateBy(SecurityUtils.getUsername());
        school.setCreateTime(DateUtils.getNowDate());
        return schoolMapper.insertSchool(school);
    }

    /**
     * 修改一卡通校园配置
     *
     * @param school 一卡通校园配置
     * @return 结果
     */
    @Override
    public int updateSchool(School school) {
        school.setUpdateBy(SecurityUtils.getUsername());
        school.setUpdateTime(DateUtils.getNowDate());
        return schoolMapper.updateSchool(school);
    }

    /**
     * 批量删除一卡通校园配置
     *
     * @param ids 需要删除的一卡通校园配置主键
     * @return 结果
     */
    @Override
    public int deleteSchoolByIds(Long[] ids) {
        return schoolMapper.deleteSchoolByIds(ids);
    }

    /**
     * 删除一卡通校园配置信息
     *
     * @param id 一卡通校园配置主键
     * @return 结果
     */
    @Override
    public int deleteSchoolById(Long id) {
        return schoolMapper.deleteSchoolById(id);
    }
}
